package rsj.api.test.offline;

import com.rlyy.aibase.utils.base.Box;
import com.rlyy.aibase.utils.base.MapNode;
import common.util.BoxUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import rsj.api.product.entity.TestQueryParam;
import rsj.api.user.BaseLink;
import rsj.service.test.ITestTemplateMethod;
import common.util.validator.ParameterConversionCheck;

/**
 * 供应商线下测试报表
 *
 * @author yuanqinglong
 * @since 2021/3/4 11:47
 */
@RestController
public class SupplierTestController extends BaseLink {

    @Autowired
    private ITestTemplateMethod supplierTest;

    /**
     * 供应商线下测试报表
     *
     * @param box 请求参数
     * @return 列表数据
     */
    @Override
    @RequestMapping(name = "rsj_supplier_test_report")
    public Box executeLink(Box box) {
        TestQueryParam testQueryParam =  ParameterConversionCheck.parameterConversionCheckFastFail(box, TestQueryParam.class, TestQueryParam.Page.class);
        MapNode mapNode = supplierTest.usageReport(testQueryParam, ITestTemplateMethod.SUPPLIER);
        return BoxUtil.successBox(box).putMapNode("data", mapNode);
    }
}
